#ifndef NO_SQLITE
#include <os/db/db_sqlite.hpp>
#endif

#ifndef NO_MYSQL
#include <os/db/db_mysql.hpp>
#endif

#ifndef NO_POSTGRESQL
#include <os/db/db_pg.hpp>
#endif

#include <os/db/db.hpp>
#include <cstring>

namespace iotplat {

    CDb *createDb(const char *dbName, const char *host, const char *engine, short port) {
        if (engine == "postgresql") {
            return new CDbPg(dbName, host, port);
        } else if (engine == "hgdb") {
            return new CDbPg(dbName, host, port, CDbPg::ExHgdb);
        } else if (strcmp(engine, "mysql") == 0) {
            return new CDbMysql(dbName, host);
        } else if (engine == "sqlite3") {
            return new CDbSqlite(dbName, host, port);
        }
        return nullptr;
    }
}